#include<bits/stdc++.h>
using namespace std;
long long n,l,r;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%lld%lld%lld",&n,&l,&r);
	long long q=l%n,p=r%n;
	if(r/n==l/n)
	{
		printf("%lld",p);
	}
	else
	{
		printf("%lld",n-1);
	}
	return 0;
}
